package com.wpml.search.controller;

import com.wpml.search.service.SearchService;
import com.wpml.search.vo.SearchParam;
import com.wpml.search.vo.SearchResult;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;

/**
 * @description:
 * @author: wp
 * @date: 2020/7/9
 **/
@Controller
public class SearchController {

    @Resource
    private SearchService searchService;

    @GetMapping({"/list.html", "/"})
    public String list(SearchParam param, Model model) {

        SearchResult result = searchService.search(param);
        model.addAttribute("result", result);

        return "list";
    }
}
